// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc.  All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// Author: robinson@google.com (Will Robinson)

// LINT: LEGACY_NAMES

syntax = "proto2";

package google.protobuf.internal;

// A message where tag numbers are listed out of order, to allow us to test our
// canonicalization of serialized output, which should always be in tag order.
// We also mix in some extensions for extra fun.
message OutOfOrderFields {
  optional sint32 optional_sint32 = 5;
  extensions 4 to 4;
  optional uint32 optional_uint32 = 3;
  extensions 2 to 2;
  optional int32 optional_int32 = 1;
}

extend OutOfOrderFields {
  optional uint64 optional_uint64 = 4;
  optional int64 optional_int64 = 2;
}

enum is {  // top level enum keyword
  default = 0;
  else = 1;  // top level enum value keyword
}

message class {  // message keyword
  optional int32 int_field = 1 [json_name = "json_int"];
  optional int32 if = 2;  // field keyword
  optional is as = 3;     // enum field keyword
  optional is enum_field = 4;
  enum for {                            // nested enum keyword
    default = 0;
    True = 1;  // nested enum value keyword
  }
  optional for nested_enum_field = 5;
  message try {
    optional int32 field = 1;
    extensions 999 to 9999;
  }
  optional try
    nested_message = 6;
  extensions 999 to 9999;
}

extend class {
  optional int32 continue = 1001;  // top level extension keyword
}

extend class.try {
  optional int32 with = 1001;
}

message ExtendClass {
  extend class {
    optional int32 return = 1002;  // nested extension keyword
  }
}

message TestFullKeyword {
  optional google.protobuf.internal.OutOfOrderFields field1 = 1;
  optional google.protobuf.internal.class field2 = 2;
}

// TODO(jieluo): Add keyword support for service.
// service False {
//   rpc Bar(class) returns (class);
// }

message LotsNestedMessage {
  message B0 {}
  message B1 {}
  message B2 {}
  message B3 {}
  message B4 {}
  message B5 {}
  message B6 {}
  message B7 {}
  message B8 {}
  message B9 {}
  message B10 {}
  message B11 {}
  message B12 {}
  message B13 {}
  message B14 {}
  message B15 {}
  message B16 {}
  message B17 {}
  message B18 {}
  message B19 {}
  message B20 {}
  message B21 {}
  message B22 {}
  message B23 {}
  message B24 {}
  message B25 {}
  message B26 {}
  message B27 {}
  message B28 {}
  message B29 {}
  message B30 {}
  message B31 {}
  message B32 {}
  message B33 {}
  message B34 {}
  message B35 {}
  message B36 {}
  message B37 {}
  message B38 {}
  message B39 {}
  message B40 {}
  message B41 {}
  message B42 {}
  message B43 {}
  message B44 {}
  message B45 {}
  message B46 {}
  message B47 {}
  message B48 {}
  message B49 {}
  message B50 {}
  message B51 {}
  message B52 {}
  message B53 {}
  message B54 {}
  message B55 {}
  message B56 {}
  message B57 {}
  message B58 {}
  message B59 {}
  message B60 {}
  message B61 {}
  message B62 {}
  message B63 {}
  message B64 {}
  message B65 {}
  message B66 {}
  message B67 {}
  message B68 {}
  message B69 {}
  message B70 {}
  message B71 {}
  message B72 {}
  message B73 {}
  message B74 {}
  message B75 {}
  message B76 {}
  message B77 {}
  message B78 {}
  message B79 {}
  message B80 {}
  message B81 {}
  message B82 {}
  message B83 {}
  message B84 {}
  message B85 {}
  message B86 {}
  message B87 {}
  message B88 {}
  message B89 {}
  message B90 {}
  message B91 {}
  message B92 {}
  message B93 {}
  message B94 {}
  message B95 {}
  message B96 {}
  message B97 {}
  message B98 {}
  message B99 {}
  message B100 {}
  message B101 {}
  message B102 {}
  message B103 {}
  message B104 {}
  message B105 {}
  message B106 {}
  message B107 {}
  message B108 {}
  message B109 {}
  message B110 {}
  message B111 {}
  message B112 {}
  message B113 {}
  message B114 {}
  message B115 {}
  message B116 {}
  message B117 {}
  message B118 {}
  message B119 {}
  message B120 {}
  message B121 {}
  message B122 {}
  message B123 {}
  message B124 {}
  message B125 {}
  message B126 {}
  message B127 {}
  message B128 {}
  message B129 {}
  message B130 {}
  message B131 {}
  message B132 {}
  message B133 {}
  message B134 {}
  message B135 {}
  message B136 {}
  message B137 {}
  message B138 {}
  message B139 {}
  message B140 {}
  message B141 {}
  message B142 {}
  message B143 {}
  message B144 {}
  message B145 {}
  message B146 {}
  message B147 {}
  message B148 {}
  message B149 {}
  message B150 {}
  message B151 {}
  message B152 {}
  message B153 {}
  message B154 {}
  message B155 {}
  message B156 {}
  message B157 {}
  message B158 {}
  message B159 {}
  message B160 {}
  message B161 {}
  message B162 {}
  message B163 {}
  message B164 {}
  message B165 {}
  message B166 {}
  message B167 {}
  message B168 {}
  message B169 {}
  message B170 {}
  message B171 {}
  message B172 {}
  message B173 {}
  message B174 {}
  message B175 {}
  message B176 {}
  message B177 {}
  message B178 {}
  message B179 {}
  message B180 {}
  message B181 {}
  message B182 {}
  message B183 {}
  message B184 {}
  message B185 {}
  message B186 {}
  message B187 {}
  message B188 {}
  message B189 {}
  message B190 {}
  message B191 {}
  message B192 {}
  message B193 {}
  message B194 {}
  message B195 {}
  message B196 {}
  message B197 {}
  message B198 {}
  message B199 {}
  message B200 {}
  message B201 {}
  message B202 {}
  message B203 {}
  message B204 {}
  message B205 {}
  message B206 {}
  message B207 {}
  message B208 {}
  message B209 {}
  message B210 {}
  message B211 {}
  message B212 {}
  message B213 {}
  message B214 {}
  message B215 {}
  message B216 {}
  message B217 {}
  message B218 {}
  message B219 {}
  message B220 {}
  message B221 {}
  message B222 {}
  message B223 {}
  message B224 {}
  message B225 {}
  message B226 {}
  message B227 {}
  message B228 {}
  message B229 {}
  message B230 {}
  message B231 {}
  message B232 {}
  message B233 {}
  message B234 {}
  message B235 {}
  message B236 {}
  message B237 {}
  message B238 {}
  message B239 {}
  message B240 {}
  message B241 {}
  message B242 {}
  message B243 {}
  message B244 {}
  message B245 {}
  message B246 {}
  message B247 {}
  message B248 {}
  message B249 {}
  message B250 {}
  message B251 {}
  message B252 {}
  message B253 {}
  message B254 {}
  message B255 {}
}

message RequiredField {
  required int32 id = 1;
}

message RequiredWrapper {
  optional RequiredField request = 1;
}
